<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<?php
session_start();
if ($_SESSION["member"] == null)
header("location:../web/index.php");
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Friend Information</title>
        <style type="text/css">
            .body {
				font-family: "Arial Black", Gadget, sans-serif;
				font-size: 12px;
				font-style: normal;
				color: #000;	
            }
			.header {
				background-image:url(../web/img/panel.png);
				background-repeat:no-repeat;
				background-size:100%;
				max-height:400px;
				min-height:400px;
				height:400px;
			}

            .main_form {
                width: 800px;
                margin-right: auto;
                margin-left: auto;
            }

            .content {
                background-color:#FFF;
            }
			.control_bar {
                width:800px;
                height:50px;
            }

            .button_control {
                -webkit-appearance: none;
				-webkit-border-image: none;
				-webkit-box-align: center;
				-webkit-box-shadow: rgb(255, 255, 255) 0px 1px 0px 0px;
				-webkit-writing-mode: horizontal-tb;
				background-color: rgb(1, 154, 210);
				background-image: linear-gradient(rgb(51, 188, 239), rgb(1, 154, 210));
				background-repeat: repeat-x;
				border-bottom-color: rgb(5, 126, 208);
				border-bottom-style: solid;
				border-bottom-width: 1px;
				border-collapse: collapse;
				border-left-color: rgb(5, 126, 208);
				border-left-style: solid;
				border-left-width: 1px;
				border-right-color: rgb(5, 126, 208);
				border-right-style: solid;
				border-right-width: 1px;
				border-top-color: rgb(5, 126, 208);
				border-top-style: solid;
				border-top-width: 1px;
				box-shadow: rgb(255, 255, 255) 0px 1px 0px 0px;
				box-sizing: border-box;
				cursor: pointer;
				display: block;
				float: right;
				font-family: 'Helvetica Neue', Arial, sans-serif;
				font-size: 13px;
				font-weight: bold;				
				letter-spacing: normal;
				line-height: 18px;
				padding-bottom: 5px;
				padding-left: 10px;
				padding-right: 10px;
				padding-top: 5px;
				position: relative;
				text-align: center;
				text-indent: 0px;
				text-shadow: rgba(0, 0, 0, 0.247059) 0px -1px 1px;
				text-transform: none;
				white-space: nowrap;
				width: 400px;
				height: 40px;
				word-spacing: 0px;
				writing-mode: lr-tb;				
            }
			.button_control a {
			color:#FFF;
			font-size:14px;
			}

            .button_control:hover {
                background-color: rgb(8, 128, 172);
				background-image: linear-gradient(rgb(18, 161, 214), rgb(4, 119, 162));
            }

            .button_control:active {
                background-color: rgb(1, 154, 210);
				background-image: linear-gradient(rgb(51, 188, 239), rgb(1, 154, 210));
            }
            .div_name {
                background-color:#36F;
                width:580px;
                height:40px;
                padding-top:5px;
                padding-left:20px;
                color:#FFF;
                font-size:20px;
                font-weight:bold;
                margin-top:30px;
                margin-left:100px;
            }

            .div_info {
                width:600px;
                padding-top:20px;
                color:#FFF;
                background-color:#3CF;
                margin-left:100px;
            }
            .div_info_row {
                width:460px;
                margin-left:70px;
                font-size:16px;	
                margin-bottom:15px;
            }
            .div_info_left_row {
                width:160px;
                float:left;
                text-align:right;
                font-weight:bold;
            }
            .div_info_right_row {
                width:300px;
                margin-left:180px;
            }
            a{
                text-decoration: none;
                color:#FFF;
            }
			.username {
			font-size:20px;
			padding-top: 5px;
			padding-bottom:5px;
			color:rgb(19, 136, 210);
			}
			.personal_info {
			font-size: 14px;
			font-style:normal;
			padding-left: 10px;
			padding-bottom:2px;
			}
			.status_item {
			width:560px;
			background-color: rgba(240, 240, 240);
			background-image: -webkit-linear-gradient(top, rgb(226, 233, 236) 0px, rgb(201, 219, 225) 100%);
			background-repeat: repeat-x;
			border-bottom-left-radius: 5px;
			border-bottom-right-radius: 5px;
			border-top-left-radius: 5px;
			border-top-right-radius: 5px;
			padding-top: 5px;
			padding-bottom:5px;
			padding-left:10px;
			padding-right:10px;
			margin-bottom:10px;
			min-height:50px;
			}
			.status_item_left {
			width:180px;
			float:left;
			}
			.status_item_user {
			font-size:14px;
			color: rgb(94, 167, 213);
			}
			.status_item_date {
			font-size:12px;
			color:#999;
			}
			.status_item_right {
			width:380px;
			margin-left:180px;
			font-size:13px;
			padding:5px;
			}
        </style>
    </head>

    <body class="body">
   		<div class="header"></div>
        <div class="main_form">
            <div class="control_bar">
            	<button class="button_control"><a href="home.php">Home</a></button>
                <button class="button_control"><a href="../bus/logout.php">Sign out</a></button>
            </div>
            <div class="content">   
                
                <?php
                require_once '../dao/messagersdao.php';
                require_once '../dao/membersdao.php';
                require_once '../dto/memberdto.php';
                require_once '../dto/messagerdto.php';
                $friendid = $_REQUEST["userid"];
                if($friendid!=NULL)
                {
                    $friend = membersdao::GetMembersByID($friendid);
					
					print "<div class='username'>".$friend->getUserID()."</div>";
                    print "<div class='personal_info'>Age: ".$friend->getAge()." years old</div>";
                    switch ($friend->getStatus()) {
                            case 0:
                                print "<div class='personal_info'>Status: Single</div>";
                                break;
                            case 1:
                                print "<div class='personal_info'>Status: Married</div>";
                                break;
                            case 2: 
                                print "<div class='personal_info'>Status: Relationship</div>";
                                break;
                            default:
                                break;
                        }
                    print "<div class='personal_info'>Email: ".$friend->getEmail()."</div>";
                    if($friend->getGender())
                        print "<div class='personal_info'>Gender: Male</div>";
                    else{
                        print "<div class='personal_info'>Gender: Female</div>";
                    }
                    print "<div class='personal_info'>Location: ".$friend->getLocation()."</div>";
					print "<br/>";
                    $lstmessages = messagersdao::getAllMessages($friendid);
                    for($i = 0;  $i<count($lstmessages); $i++)
                    {
						print "<div class='status_item'>";
                        	print "<div class='status_item_left'>";
                            	print "<div class='status_item_user'>".$lstmessages[$i]->getUserID()."</div>";
                                print "<div class='status_item_date'>" . $lstmessages[$i]->getDatePost() . "</div>";
                            print "</div>";
                            print "<div class='status_item_right'>".$lstmessages[$i]->getContentOfMessages()."</div>";
                       	 	print "</div>";
                    }
                    print"</table>";
                    print"</div>";
                } else {
                    header("location:../web/errorpage.php");
                }
                ?>
            </div>                     
        </div>
    </body>
</html>
